<template>
  <div>
    <div>当前微博用户ID:{{uid}}</div>
    <div>
      <el-form label-position="left" :model="user" ref="form" :rules="rules" size="mini">

        <el-form-item label="用户名" prop="username">
          <el-input v-model="user.username" type="text"></el-input>
        </el-form-item>

        <el-form-item label="密码" prop="password">
          <el-input v-model="user.password" type="password"></el-input>
        </el-form-item>

        <el-form-item>
          <el-button @click="bind" type="primary">绑定</el-button>
        </el-form-item>

      </el-form>
    </div>
  </div>
</template>

<script>
  export default {
    name: "Weibo_bind",
    data: function () {
      return {
        uid: this.$route.params['uid'],
        user: {
          'username': '',
          'password': ''
        },
        rules: {
          username: [
            {required: true, message: '请输入用户名', trigger: 'blur'},
            {min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur'}
          ],
          password: [
            {required: true, message: '请输入密码', trigger: 'blur'},
            {min: 6, max: 12, message: '长度在 6 到 12 个字符', trigger: 'blur'}
          ],
        }
      }
    },
    mounted() {
    },
    methods: {
      bind() {
        this.axios({
          url: 'http://localhost:8000/myapp/weibo_bind/',
          method: 'post',
          data: {
            'username': this.user.username,
            'password': this.user.password,
            'uid' : this.uid
          }
        }).then(res => {
          console.log(res.data)
        })
      }
    }
  }
</script>

<style scoped>

</style>
